﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace calculator
{
    class Program
    {
        //test for git
        static void Main(string[] args)
        {
            Console.WriteLine("输入两个数字和一个运算符");
            Console.Write("数字1:  ");
            string num1 = Console.ReadLine();
            Console.Write("数字2:  ");
            string num2 = Console.ReadLine();
            Console.Write("运算符:  ");
            string op = Console.ReadLine();
            double s1 = double.Parse(num1);
            double s2 = double.Parse(num2);
            double res = 0;
            int flag = 1;
            switch (op)
            {
                case "*":
                    res = s1 * s2;
                    break;
                case "+":
                    res = s1 + s2;
                    break;
                case "-":
                    res = s1 - s2;
                    break;
                case "/":
                    if (s2 != 0)
                    {
                        res = s1 / s2;
                    }
                    else { flag = 0; }
                    break;
                default:
                    flag = 0;
                    Console.WriteLine("输入错误");
                    break;
            }
            if (flag == 1)
            {
                Console.WriteLine(num1 + op + num2 + "=" + res.ToString());
            }
            else { Console.WriteLine("输入错误"); }
        }
    }
}

